---
id: "val-decorator"
keywords: ["val", "decorator"]
name: "@val"
summary: "This is the `@val` decorator."
category: "decorators"
---

The `@val` decorator allows you to bind to JavaScript values that are on the global scope.

### Example

<CodeTab labels={["ReScript", "JS Output"]}>

```res
type timeoutID

@val
external setTimeout: (unit => unit, int) => timeoutID = "setTimeout"

let timeoutID = setTimeout(() => Console.log("Hello"), 1000)
```

```js
var timeoutID = setTimeout(function (param) {
  console.log("Hello");
}, 1000);
```

</CodeTab>

### References

- [Bind to Global JS Values](../docs/manual/bind-to-global-js-values.mdx)
